package edu.udlap.spring2008.is300.finalexam.app.mvc.view;

import java.awt.LayoutManager;
import javax.swing.BorderFactory;
import javax.swing.border.TitledBorder;

/**
 *
 * @author Ruslán Ledesma Garza
 */
public class ViewTitledPanel extends ViewPanel
{
    protected boolean collapsed_ = false;
    
    protected TitledBorder titledBorder_;
    
    protected String title_;

    public ViewTitledPanel()
    {
        this("");
    }
    
    public ViewTitledPanel(String title)
    {   
        titledBorder_ = BorderFactory.createTitledBorder("");
        titledBorder_.setTitleJustification(TitledBorder.CENTER);
        
        contentPanel_.setBorder(titledBorder_);
        
        setTitle(title);
    }
    
    public ViewTitledPanel(String title, LayoutManager layoutManager)
    {
        this(title);
        setLayout(layoutManager);
    }
    
    public String getTitle()
    {
        return title_;
    }

    public void setTitle(String title)
    {
        title_ = title;
        titledBorder_.setTitle(title_);
    }
}
